package part1.api.collection.collectiontest;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionOperDemo {
    public static void main(String[] args) {
        Collection c1 = new ArrayList();
        c1.add("java");
        c1.add("c++");
        c1.add("c");
        c1.add("php");
        System.out.println("c1初始："+c1);

        Collection c2 = new ArrayList();
        c2.add("c++");
        c2.add("sql");
        c2.add(".net");
        System.out.println("c2:"+c2);

        //addAll()
        boolean addall = c1.addAll(c2);
        System.out.println("c1添加后:"+c1);

        //containsAll()
        boolean conall = c1.containsAll(c2);
        System.out.println(conall);

        //retainAll()
        boolean retain = c1.retainAll(c2);
        System.out.println("c1取交集后："+c1);

        //removeAll()
        boolean reall = c1.removeAll(c2);
        System.out.println("c1去除交集后："+c1);
    }
}
